package cn.hgpu.mapper;

import cn.hgpu.pojo.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface RoleMapper {
    /**
     * 查询所有
     * @return
     */
    @Select("select * from t_role")
    List<Role> selectAll();

    /**
     *
     *根据名称查询
     */
    @Select("select * from t_role where role = #{roleName}")
    Role selectByRoleName(String roleName);

    /**
     * 添加角色
     */
    @Insert("insert into t_role(role) values(#{roleName})")
    void insert(String roleName);

    /**
     * 编辑角色
     */
    @Update("update t_role set role=#{roleName} where id=#{id}")
    void update(@Param("id") int id, @Param("roleName") String roleName);

    /**
     * 删除角色
     */
    @Delete("delete from t_role where id = #{id}")
    void deleteById(int id);
}
